[SUBROUTINE]
version = 1.14
icon = circle-2.png
name = _("Circle 2 points")
type = circle-2
help = _("<b>Create a Circle by defining ends of diameter</b>&#10;Points are the ends of the diameter and can add a flat")
order = act fcut h1 x1 y1 x2 y2 h2 f rot h3 opt dir

[PARAM_ACT]
name = _("Active")
icon = enable.png
type = bool
value = 1

[PARAM_FCUT]
name = _("Show design")
icon = glasses.png
type = bool
value = 1

[PARAM_H1]
name = _("Coords")
type = sub-header

[PARAM_X1]
name = _("X1")
type = float
icon = x.png
tool_tip = _("One end of the diameter")
value = 0.0
metric_value = 0.0
header = h1

[PARAM_Y1]
name = _("Y1")
type = float
icon = y.png
tool_tip = _("One end of the diameter")
value = 0.0
metric_value = 0.0
header = h1

[PARAM_X2]
name = _("X2")
type = float
icon = x.png
tool_tip = _("Opposite end of the diameter")
value = 2
header = h1
metric_value = 50

[PARAM_Y2]
name = _("Y2")
type = float
icon = y.png
tool_tip = _("Opposite end of the diameter")
value = 1
header = h1
metric_value = 25

[PARAM_H2]
name = _("D flat")
type = sub-header

[PARAM_F]
name = _("Remove")
icon = d-flat.png
type = float
minimum_value = 0.0
tool_tip = _("Height to remove from diameter")
value = 0.0
header = h2
metric_value = 0.0

[PARAM_ROT]
name = _("Rotation")
type = float
digits = 2
icon = angle.png
tool_tip = _("Rotation of flat")
value = 0
header = h2
suffix = &#176;

[PARAM_H3]
name = _("Cutting")
type = sub-header

[PARAM_OPT]
name = _("Option")
type = combo
options = _("Inside=0:On the line=2:Outside=3")
icon = g4x.png
tool_tip = _("Select tool path")
value = 0
header = h3

[PARAM_DIR]
name = _("Direction")
type = combo
options = _("Clockwise=2:Counter-Clockwise=3")
icon = cw-ccw.png
tool_tip = _("Direction of path")
value = 3
header = h3

[DEFINITIONS]
content =
;	<eval>self.include_once(file name here)</eval>

[CALL]
content = 
	(begin #sub_name)
	(circle from ends of diameter author : Fernand Veilleux)
	o<#self_id_active> if [#param_act] (if active)
		#<flat#ID> = [#param_f]
		#<delx#ID> = [#param_x2 - #param_x1]
		#<dely#ID> = [#param_y2 - #param_y1]
		#<diameter#ID> = [SQRT[#<delx#ID> * #<delx#ID> + #<dely#ID> * #<dely#ID>]]
		#<cx#ID> = [[#param_x1 + #param_x2] / 2]
		#<cy#ID> = [[#param_y1 + #param_y2] / 2]
	
		o<circle> CALL [#<cx#ID>] [#<cy#ID>] [#<diameter#ID>] [#<flat#ID>] [#param_rot] [#param_opt] [#param_dir] [#<pl_cut_start>] [#<surface>] [#<bottom>] [#param_fcut]
	o<#self_id_active> endif
	(end #sub_name)
